﻿#define _CRT_SECURE_NO_WARNINGS
#include "1.11_hs.h"
//int main()
//{
//	int n = 0x11223344;
//	int m = 0x11223344;
//	int* p1 = &n;
//	char* p2 = (char*) & m;
//	printf("%d %d\n", *p1, *p2);
//	*p1 = 0;
//	*p2 = 0;
//	printf("%d %d\n%p %p\n%p %p", *p1, *p2, &n, p1 +1,&m,p2+1);
//	return 0;
//}

//int main()
//{
//	/*test1();*/
//	/*test2();*/
//	/*test3();*/
//	test4();
//	return 0;
//}

//int main()
//{
//	float f1 = 0.1f;
//	float f2 = 0.2f;
//	float f3 = 0.3f;
//	float* pf[] = { &f1,&f2,&f3 };
//	printf("%f %f %f", *pf[0], *pf[1], *pf[2]);
//	char* pc = NULL;
//	assert(pc);
//	printf("\n%p %p %x %x", 255,-1, 255, -1);
//	return 0;
//}

//int main()
//{
//	struct emp e1 = { "张三",18 };
//	struct emp e2 = { "李四",18 };
//	struct emp e3 = { "王五",18 };
//	printf("%s %d %s %d %s %d\n", e1.name, e1.age, e2.name, e2.age, e3.name, e3.age);
//	struct emp* p[] = { &e1,&e2,&e3 };
//	char str[][9] = { "南宫婉","紫灵","慕沛灵" };
//	for (int i = 0; i < sizeof(p) / sizeof(p[0]); i++)
//	{
//		Print_p(set_p(p[i], str[i]));
//	}
//	int(*p1)(int, int) = add;
//	int(*p2)(int, int) = &add;
//	int(*p3[])(int, int) = { add,&sub };
//	printf("%d %d %d %d\n", p1(1, 6), (*p2)(1, 6), p3[0](1, 6), p3[1](1, 6));
//	printf("%p %p", add, signal(add, 6));
//	return 0;
//}

//int main()
//{
//	printf("%zd\n", sizeof(int));
//	printf("%zd\n", sizeof(float));
//	printf("%zd\n", sizeof(1));
//	printf("%zd\n", sizeof('c'));
//	printf("%zd\n", sizeof(NULL));
//	return 0;
//}

//int main()
//{
//	int a[] = { 1,2,3,4 };
//	printf("%zd\n", sizeof(a));//16
//	printf("%zd\n", sizeof(a + 0));//8
//	printf("%zd\n", sizeof(*a));//4
//	printf("%zd\n", sizeof(a + 1));//8
//	printf("%zd\n", sizeof(a[1]));//4
//	printf("%zd\n", sizeof(&a));//8
//	printf("%zd\n", sizeof(*&a));//16
//	printf("%zd\n", sizeof(&a + 1));//8
//	printf("%zd\n", sizeof(&a[0]));//8
//	printf("%zd\n", sizeof(&a[0] + 1));//8
//	return 0;
//}

//int main()
//{
//	char arr[] = { 'a','b', 'c', 'd', 'e', 'f' };
//	printf("%zd\n", sizeof(arr));//6
//	printf("%zd\n", sizeof(arr + 0));//8
//	printf("%zd\n", sizeof(*arr));//1
//	printf("%zd\n", sizeof(arr[1]));//1
//	printf("%zd\n", sizeof(&arr));//8
//	printf("%zd\n", sizeof(&arr + 1));//8
//	printf("%zd\n", sizeof(&arr[0] + 1));//8
//	return 0;
//}

//int main()
//{
//	char arr[] = { 'a','b', 'c', 'd', 'e', 'f' };
//	printf("%zd\n", strlen(arr));//随机值
//	printf("%zd\n", strlen(arr + 0));//随机值
//	printf("%zd\n", strlen(*arr));//非法访问
//	printf("%zd\n", strlen(arr[1]));//非法访问
//	printf("%zd\n", strlen(&arr));//随机值
//	printf("%zd\n", strlen(&arr + 1));//随机值
//	printf("%zd\n", strlen(&arr[0] + 1));//随机值
//	return 0;
//}

//int main()
//{
//	char arr[] = "abcdef";
//	printf("%zd\n", sizeof(arr));//7
//	printf("%zd\n", sizeof(arr + 0));//8
//	printf("%zd\n", sizeof(*arr));//1
//	printf("%zd\n", sizeof(arr[1]));//1
//	printf("%zd\n", sizeof(&arr));//8
//	printf("%zd\n", sizeof(&arr + 1));//8
//	printf("%zd\n", sizeof(&arr[0] + 1));//8
//	return 0;
//}

//int main()
//{
//	char arr[] = "abcdef";
//	printf("%zd\n", strlen(arr));//6
//	printf("%zd\n", strlen(arr + 0));//6
//	//printf("%zd\n", strlen(*arr));//非法访问
//	//printf("%zd\n", strlen(arr[1]));//非法访问
//	printf("%zd\n", strlen(&arr));//6
//	printf("%zd\n", strlen(&arr + 1));//随机值
//	printf("%zd\n", strlen(&arr[0] + 1));//5
//	return 0;
//}

//int main()
//{
//	char* p = "abcdef";
//	printf("%zd\n", sizeof(p));//8
//	printf("%zd\n", sizeof(p + 1));//8
//	printf("%zd\n", sizeof(*p));//1
//	printf("%zd\n", sizeof(p[0]));//1
//	printf("%zd\n", sizeof(&p));//8
//	printf("%zd\n", sizeof(&p + 1));//8
//	printf("%zd\n", sizeof(&p[0] + 1));//8
//	return 0;
//}

//int main()
//{
//	char* p = "abcdef";
//	printf("%zd\n", strlen(p));//6
//	printf("%zd\n", strlen(p + 1));//5
//	//printf("%zd\n", strlen(*p));//非法访问
//	//printf("%zd\n", strlen(p[0]));//非法访问
//	printf("%zd\n", strlen(&p));//6
//	printf("%zd\n", strlen(&p + 1));//随机值
//	printf("%zd\n", strlen(&p[0] + 1));//5
//	return 0;
//}

//int main()
//{
//	int a[3][4] = { 0 };
//	printf("%zd\n", sizeof(a));//48
//	printf("%zd\n", sizeof(a[0][0]));//4
//	printf("%zd\n", sizeof(a[0]));//16
//	printf("%zd\n", sizeof(a[0] + 1));//8
//	printf("%zd\n", sizeof(*(a[0] + 1)));//4
//	printf("%zd\n", sizeof(a + 1));//8
//	printf("%zd\n", sizeof(*(a + 1)));//16
//	printf("%zd\n", sizeof(&a[0] + 1));//8
//	printf("%zd\n", sizeof(*(&a[0] + 1)));//16
//	printf("%zd\n", sizeof(*a));//16
//	printf("%zd\n", sizeof(a[3]));//16
//	return 0;
//}

//int main()
//{
//	int a[5] = { 1, 2, 3, 4, 5 };
//	int* ptr = (int*)(&a + 1);
//	printf("%d,%d", *(a + 1), *(ptr - 1));
//	return 0;
//}

//在X86环境下
//假设结构体的⼤⼩是20个字节
//程序输出的结果是啥？
//struct test
//{
//	int Num;
//	char* pcName;
//	short sDate;
//	char cha[2];
//	short sBa[4];
//}*p = (struct Test*)0x100000;
//
//int main()
//{
//	printf("%p\n", p + 0x1);
//	printf("%p\n", (unsigned long)p + 0x1);
//	printf("%p\n", (unsigned int*)p + 0x1);
//	return 0;
//}